package Test2;

import java.util.HashSet;
import java.util.Scanner;

public class PrimeFactors {
	public static void main(String[] args){
		String strN;
        System.out.println("Masukan satu bilangan = ");
        Scanner scanIn = new Scanner(System.in);
        strN = scanIn.nextLine();
        int n = Integer.parseInt(strN);
        //CetakPrima(n);
        if(CheckPrime(n)==false){
        	FactorsTree(n);
        }else{
        	System.out.println("Merupakan bilangan prima");
        }
	}
	
	public static boolean CheckPrime(int n){
		boolean isPrime=true;
		if (n==2 || n%2!=0){
			 isPrime=true;
		}else{
			isPrime=false;
		}
		return isPrime;
	}
	
	public static void FactorsTree(int n){
		int[] arr;
		HashSet<Integer> daftar = new HashSet<Integer>();
		
		for (int i=2; i<n; i++){
			if (n%2==0){
				n=n/2;
				daftar.add(2);
			}else if (n%3==0){
				n=n/3;
				daftar.add(3);
			}else if (n%5==0){
				n=n/5;
				daftar.add(5);
			}
		}
		
		System.out.println("Keluaran = "+daftar);
	}
	
}
